jQuery(document).ready(function(){
  var $ = jQuery;
  
  var $residencial_status = $("#edit-residential-status");
  var $local = $("#edit-residential-status-local");
  var $nationality = $("#edit-nationality");
  var former_local_checked = false;
  
  $residencial_status.change(function(){
    if($local.attr("checked")){
      if(!former_local_checked){
        former_local_checked = true;
        $nationality.val("Singapore");
      }
    } else{
      /*  would add back in when necessary
      former_local_checked = false;
      $nationality.val("");
      */
    }
  });
});
